package com.sdy.healthcode.biz.service;

import com.sdy.common.model.BizException;
import com.sdy.healthcode.biz.constants.HealthCodeType;
import com.sdy.healthcode.biz.dto.CodeCountPack;
import com.sdy.healthcode.biz.dto.UserApplyPost;
import com.sdy.healthcode.biz.model.HealthClockIn;
import com.sdy.healthcode.biz.model.HealthCode;
import com.sdy.mvc.service.BaseService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zzq
 * @since 2020-02-18
 */
public interface HealthCodeService extends BaseService<HealthCode> {
    /**
     * 申请健康码
     * @param userApplyPost 申请表单
     */
    void applyForCodeLockable(UserApplyPost userApplyPost, String redirectUrl) throws BizException;
    /**
     * 申请健康码
     * @param userApplyPost 申请表单
     */
    void applyForCode(UserApplyPost userApplyPost, String redirectUrl) throws BizException, InterruptedException;

    /**
     * 使健康码无效
     */
    void invalidAllCodeForUser(Integer userId);

    /**
     * 查询用户健康码
     */
    HealthCode queryHealthCode(Integer userId);

    /**
     * 查询用户健康码
     */
    HealthCode queryHealthCodeByToken(String token);

    /**
     * 找不到二维码文件，重新生成
     */
    void reGenerateHealthQrCode(HealthCode healthCode, String redirectUrl);

    /**
     * 根据打卡数据更新健康码
     * @param userId 用户ID
     * @param currentClockIn 当前打卡数据
     */
    void reEvaluateFromClockInData(Integer userId, HealthClockIn currentClockIn);

    CodeCountPack getCodeCount(String code);

    /**
     * 直接更新用户健康码
     */
    void updateHealthCode(HealthCodeType newHealthCodeType, Integer userId, String source);

    /**
     * 获取本院红黄绿码数
     * @return
     */
    List<Map<String,Object>> getHospitalNum();
}
